<template>
  <div class="header">

      <div @click="backLogin" class="el-icon-caret-left left"></div>

    <el-input placeholder="请输入城市/游玩景点" prefix-icon="el-icon-search" v-model="inp"></el-input>
    <div class="right">
      <router-link to="/city">
        <div class="city-text">{{cityName}} </div>
      </router-link>
      <div class="el-icon-caret-bottom to"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeHeader",
  data() {
    return {
      inp: "",
      cityName:sessionStorage.getItem("cityName") ||"杭州"
    };
  },
  methods:{
    backLogin(){
      this.$message.success('退出');
      window.sessionStorage.clear()
      this.$router.push('/')
    }
  }
};
</script>

<style>
.header {
  width: 100%;
  background: #00bcd4;
  display: flex;
  border-bottom: 0.01rem solid #ccc;
}
.left {
  color: #fff;
  font-size: 0.2rem;
  padding-top: 0.1rem;
  padding-right: 0.1rem;
  padding-left: 0.05rem;
}
.right {
  padding-top: 0.05rem;
  display: flex;
  padding-right: 0.05rem;
  color: #fff;
}
.city-text {
  padding-top: 0.08rem;
  width: 0.4rem;
  font-size: 0.16rem;
  padding-left: 0.05rem;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.to {
  font-size: 0.2rem;
  padding-top: 0.05rem;
}
</style>